package com.ruoyi.jproom.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.jproom.entity.Housing;
import com.ruoyi.jproom.entity.Residential;
import com.ruoyi.jproom.entity.Sell;
import com.ruoyi.jproom.service.SellService;
import com.ruoyi.jproom.utils.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zeo
 * @explain 出售信息控制层
 * @date 2020/7/27 15:18
 */
@Controller
@RequestMapping("/sell")
public class SellController extends BaseController {

    @Autowired
    private SellService sellService;

    /**
     * 主页推荐出租、二手房房源
     * 1.主页推荐出租、二手房房源
     * @return
     */
    @RequestMapping("/findAllRecommend")
    @ResponseBody
    public BaseResult findAllRecommend(Residential residential, Housing housing, Sell sell){
        return sellService.findAllRecommend(residential,housing,sell);
    }

    /**
     * 修改房源为已出售
     * @param housingId
     * @return
     */
    @RequestMapping("/changeIsDeal")
    @ResponseBody
    public AjaxResult changeIsDeal(String housingId,int isDeal){
        return toAjax(sellService.changeIsDeal(housingId,isDeal));
    }
}
